X86: Prefer TSC-deadline timer in Xen
authorKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 09:40:14 +0000 (10:40 +0100)
committerKeir Fraser <keir@xen.org>
Fri, 29 Oct 2010 09:40:14 +0000 (10:40 +0100)
commitfd1291a826e17108d7c7f20c887847daba451ef4
tree963f0da4548bc87d110ff0a4982f1b14f913be29
parent9dbd1007376011d99e6af1dd703c2cc437e7fda0
X86: Prefer TSC-deadline timer in Xen

The new TSC Deadline Timer offers system software a low overhead
per-logical-thread deadline timer in TSC units.

The timer is implemented via a new architectural 64-bit register,
IA32_TSC_DEADLINE_MSR. Reads and writes of this MSR occur in program
order, but are non-serializing.

The support for this feature is indicated by
CPUID.01H:ECX.TSC_Deadline[bit 24] =3D 1 as documented in the Intel
Architecture Software Developer's Manual.

The LOCAL APIC on new processors has a mode where its underlying
hardware timer can now be accessed via the non-serializing
IA32_TSC_DEADLINE_MSR in TSC tick units.

If this mode is present, prefer it over the traditional LAPIC timer
mode.  KERN_DEBUG dmesg will print "TSC deadline timer enabled" when
TDT is used.

Bootparam "tdt=off" is available to revert to LAPIC timer mode.

This patch is based on original work by Len Brown for Linux kernel.

cc: Len Brown <len.brown@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir@xen.org>
xen/arch/x86/apic.c
xen/arch/x86/time.c
xen/include/asm-x86/cpufeature.h
xen/include/asm-x86/msr-index.h
xen/include/asm-x86/time.h
xen/include/xen/time.h